const Router = require('koa-router');

const router = new Router({ prefix: '/goods' });

const { auth, hadAdminPermission } = require('../middleware/auth.middleware')

const { validator } = require('../middleware/goods.middleware')

const { upload, create, update, remove } = require('../controller/goods.controller');

//上传
router.post('/upload', auth, hadAdminPermission, upload)

//发布商品
router.post('/releasedGoods', auth, hadAdminPermission, validator, create)

//发布商品
router.put('/update', auth, hadAdminPermission, update)

//删除（硬删除）
router.delete('/:id', auth, remove)

module.exports = router;